# frv testcase for nfsqrts $FRj,$FRk
# mach: fr500 fr550 frv

	.include "testutils.inc"

	float_constants
	start
	load_float_constants

	.global nfsqrts
nfsqrts:
	nfsqrts		fr44,fr1		; 9.0
	test_fr_fr	fr1,fr36		; 3.0
	test_spr_immed	0,fner1
	test_spr_immed	0,fner0

	set_fr_iimmed	0x4049,0x0fdb,fr10	; 3.141592654
	nfsqrts		fr10,fr10
	test_fr_iimmed	0x3fe2dfc5,fr10		; 1.7724539
	test_spr_immed	0,fner1
	test_spr_immed	0,fner0

	; fp_exceptions
	nfsqrts		fr8,fr1			; -1 -- invalid
	test_fr_iimmed	0x7fc00000,fr1		; nan1
	test_spr_immed	2,fner1
	test_spr_immed	0,fner0
	test_spr_bits	0x80000000,31,0x0,fqst0	; fq0.miv is clear
	test_spr_bits	0x18000,15,0x0,fqst0	; fq0.sie is clear
	test_spr_bits	0x380,7,0x0,fqst0	; fq0.ftt is clear
	test_spr_bits	0x7e,1,0x0,fqst0	; fq0.cexc is clear
	test_spr_bits	0x1,0,0x0,fqst0		; fq0.valid is clear
	test_spr_immed	0,fqop0			; fq0.opc

	pass
